<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" />
  <script src="http://activity.hcoriental.com/jquery-3.3.1.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/clipboard@1/dist/clipboard.min.js"></script>
  <script type="text/javascript">
  // 加入友盟ＧＡ
    switch ('{{mch_name}}') {
      case 'xingyuncp':

        break;

      default:
        var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");
        document.write(unescape("%3Cspan id='cnzz_stat_icon_1273487022'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s13.cnzz.com/z_stat.php%3Fid%3D1273487022' type='text/javascript'%3E%3C/script%3E"));
        break;
    }
  </script>
  <script>
    //參數
    var request = new Object(); //擷取url參數類別
    var page = 0; //頁面變數
    var textObj = { listId: "银行卡号", listName: "入款人姓名", bankId: "请输入您转账的银行卡号", bankName: "请填写入款人姓名", vbankId: "请输入正确的银行卡号", vbankName: "请输入正确的真实姓名" }
    //顯示訊息變數
    var money = 0;
    var submitTouch = true;
    // 轉換帳戶資訊
    var transfer = null;
    var listId = null;
    var listName = null;
    var bankId = null;
    var bankName = null;
    // 表單驗證
    var vbankStyle = null;
    var vbank = null;
    var verificationMsg = "";
    var vamount = null;
    var vbankId = null;
    var vbankName = null;
    // APP導入鏈結位置
    var request = new Object();
    var inAPP = "";
  </script>
  <script>
    // 擷取url參數值
    function GetRequest() {
      var url = location.search; //获取url中"?"符后的字串
      var theRequest = new Object();
      if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
          theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
        }
      }
      return theRequest;
    }

    // 顯示彈出訊息
    function openMsg(msg, timeOff, time) {
      $(".bg").show();
      $(".alter_content").text(msg);
      $(".alter_content").show();
      if (timeOff === true) {
        setTimeout(function () {
          $(".bg").hide();
          $(".alter_content").hide();
        }, time);
      }
    }
    // 擷取url參數值
    function GetRequest() {
      var url = location.search; //获取url中"?"符后的字串
      var theRequest = new Object();
      if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
          theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
        }
      }
      return theRequest;
    }
  </script>
  <script>
    $(function () {
      // if (/wv/.test(navigator.userAgent.toLowerCase())) {
      //   $('.header').hide()
      //   console.log('webView')
      // } else {
      //   $('.header').show()
      //   console.log('web')
      // }
      request = GetRequest();
      inAPP = '{{mch_name}}';
      bankName = document.querySelector("#bankName");
      switch (inAPP) {
        case 'xingyuncp':
          $("#listName").text("存款人姓名")
          $("#bankStyleH4").text("转帐方式")
          bankName.setAttribute("placeholder", "请填写存款人姓名");
          $('#riders_img').attr('src', 'http://ow8xcte3z.bkt.clouddn.com/chargeprocess.jpg');
          $("#message_p").text("单笔最低转帐金额为50元, 100元以上可享1%充值返利")
          break;

        default:
          $("#listName").text("入款人姓名")
          $("#bankStyleH4").text("入款方式")
          bankName.setAttribute("placeholder", "请填写入款人姓名");
          $('#riders_img').attr('src', 'http://p.hcoriental.com/strategy.jpg');
          $("#message_p").text("单笔最低转帐金额为50元, 100元以上可享1%充值返利")
          break;
      }
      // 頁面切換
      function goPage(page) {
        switch (page) {
          case 2:
            money = $("#amount").val().replace(/\b(0+)/gi, "");
            $("#page1").hide();
            $("#page2").show();
            $("#page3").hide();
            $("#user_amount").text("提交金额 " + money + "元，若订单确认无误，系统充值将会在1分钟内到帐，请留意站内消息通知")
            break;
          case 3:
            $("#page1").hide();
            $("#page2").hide();
            $("#page3").show();
            break;
          default:
            $("#listNotShow").hide();
            $("#page1").show();
            $("#page2").hide();
            $("#page3").hide();
            $(".transferAccount").hide();
            $("#checkSubmit").show();
            break;
        }
      }
      // 起始頁面
      goPage(1);
      //回首页
      $(".backToHome").click(function () {
        switch (inAPP) {
          case 'xingyuncp':
            location.href = "xingyuncp://open/home?index=4";
            break;
          default:
            location.href = "cp://open/home?index=3";
            break;
        }
      })
      // 轉帳攻略返回
      $("#page3 div").click(function () {
        goPage(1);
      });
      $("#backP1").click(function () {
        goPage(1);
      });
      $("#backP2").click(function () {
        $('.list input').removeAttr("readonly");
        $('.list select').attr("disabled", false);
        goPage(2);
      });
      $("#backP3").click(function () {
        goPage(3);
      });
      //關閉彈出訊息背景
      $(".bg").click(function () {
        $(".bg").hide();
        $(".alter_content").hide();
      });
      $(".alter_content").click(function () {
        $(".bg").hide();
        $(".alter_content").hide();
      });
      //一鍵複製觸發方法
      $("#copy").click(
        function oneTouchCopy() {
          var clipboard = new Clipboard(".copybtn", {
            container: document.getElementById("bankCard")
          });
          clipboard.on("success", function (e) {
            console.log("複製成功");
            e.clearSelection();
            openMsg("复制成功", true, 1000)
          });
          clipboard.on("error", function (e) {
            console.log("複製失敗")
            console.error("Action:", e.action);
            console.error("Trigger:", e.trigger);
            openMsg("复制失败，请手动复制", true, 1000)
          });
        });
      $("#copyOwner").click(
        function oneTouchCopy() {
          var clipboardOwner = new Clipboard(".copybtn", {
            container: document.getElementById("bankOwner")
          });
          clipboardOwner.on("success", function (e) {
            console.log("複製成功")
            e.clearSelection();
            openMsg("复制成功", true, 1000)
          });
          clipboardOwner.on("error", function (e) {
            console.log("複製失敗")
            console.error("Action:", e.action);
            console.error("Trigger:", e.trigger);
            openMsg("复制失败，请手动复制", true, 1000)
          });
        });
      // 轉換帳戶資訊
      $("#bankStyle").change(function () {
        transfer = $("#bankStyle").val();
        listId = document.querySelector("#listId");
        listName = document.querySelector("#listName");
        bankId = document.querySelector("#bankId");
        bankName = document.querySelector("#bankName");
        $("#bankId").val("")
        switch (transfer) {
          case "bankcard":
            $("#listNotShow").hide();
            $("#applyBank").show();
            switch (inAPP) {
              case 'xingyuncp':
                textObj = { listId: "银行卡号", listName: "存款人姓名", bankId: "请输入您转账的银行卡号", bankName: "请填写存款人姓名", vbankId: "请输入正确的银行卡号", vbankName: "请输入正确的真实姓名" }
                break;
              default:
                textObj = { listId: "银行卡号", listName: "入款人姓名", bankId: "请输入您转账的银行卡号", bankName: "请填写入款人姓名", vbankId: "请输入正确的银行卡号", vbankName: "请输入正确的真实姓名" }
                break;
            }
            break;
          case "alipay":
            $("#listNotShow").show();
            $("#applyBank").hide();
            switch (inAPP) {
              case 'xingyuncp':
                textObj = { listId: "支付宝账号", listName: "存款人姓名", bankId: "请输入您转账的支付宝账号", bankName: "请填写存款人姓名", vbankId: "请输入正确的支付宝账号", vbankName: "请输入正确的真实姓名" }
                break;
              default:
                textObj = { listId: "支付宝账号", listName: "入款人姓名", bankId: "请输入您转账的支付宝账号", bankName: "请填写入款人姓名", vbankId: "请输入正确的支付宝账号", vbankName: "请输入正确的真实姓名" }
                break;
            }
            break;
          case "wechat":
            $("#listNotShow").show();
            $("#applyBank").hide();
            switch (inAPP) {
              case 'xingyuncp':
                textObj = { listId: "微信账号", listName: "存款人姓名", bankId: "请输入您转账的微信账号", bankName: "请填写存款人姓名", vbankId: "请输入正确的微信账号", vbankName: "请输入正确的真实姓名" }
                break;
              default:
                textObj = { listId: "微信账号", listName: "入款人姓名", bankId: "请输入您转账的微信账号", bankName: "请填写入款人姓名", vbankId: "请输入正确的微信账号", vbankName: "请输入正确的真实姓名" }
                break;
            }
            break;
          case "others":
            $("#listNotShow").hide();
            $("#applyBank").hide();
            switch (inAPP) {
              case 'xingyuncp':
                textObj = { listId: "转账账号", listName: "存款人姓名", bankId: "请输入您的账号信息", bankName: "请填写存款人姓名", vbankId: "请输入正确的转账账号", vbankName: "请输入正确的真实姓名" }
                break;
              default:
                textObj = { listId: "转账账号", listName: "入款人姓名", bankId: "请输入您的账号信息", bankName: "请填写入款人姓名", vbankId: "请输入正确的转账账号", vbankName: "请输入正确的真实姓名" }
                break;
            }
            break;
        }
        listId.textContent = textObj.listId;
        listName.textContent = textObj.listName;
        bankId.setAttribute("placeholder", textObj.bankId);
        bankName.setAttribute("placeholder", textObj.bankName);
      });
    });
  </script>
  <script>
    $(function () {
      function checkFunction() {
        // 表單驗證
        vbankStyle = $("#bankStyle").val().trim();
        vbank = $("#bank").val().trim();
        verificationMsg = "";
        vamount = $("#amount").val().trim().replace(/\b(0+)/gi, "");
        vbankId = $("#bankId").val().trim();
        vbankName = $("#bankName").val().trim();
        // 表單鎖定並更新金額字串
        $("#amount").val(vamount);
        $('.list input').attr("readonly", "readonly")
        $('.list select').attr("disabled", true);
        // 表單驗證
        if (vbankName == null || vbankName == undefined || vbankName == "") {
          verificationMsg = textObj.bankName
        }
        if (vbankStyle === "bankcard") {
          if ((vbank == null || vbank == undefined || vbank == 1) && (verificationMsg == "")) {
            verificationMsg = "请选择您的开户银行"
          }
        }
        if (((vbankId == null || vbankId == undefined || vbankId == "") && (vbankStyle != 'bankcard') && (vbankStyle != "others")) && (verificationMsg == "")) {
          verificationMsg = textObj.bankId
        }
        if ((vamount <= 0) && (verificationMsg == "")) {
          verificationMsg = "请输入正确到账金额"
        }
        if ((vamount < 50) && (verificationMsg == "")) {
          verificationMsg = "最低转帐金额为50元"
        }
        if (verificationMsg != "") {
          //表單驗證錯誤訊息顯示
          openMsg(verificationMsg, true, 1000);
          $('.list input').removeAttr("readonly");
          $('.list select').attr("disabled", false);
        }
        if (vbankStyle !== "bankcard") {
          bank = "";
        }
        if ((submitTouch) && (verificationMsg == "")) {
          // 開啟loading 畫面
          $(".bg").show();
          $(".loading_img").show();
          // $(".transferAccount").show();
          // $("#checkSubmit").hide();
          submitTouch = false
          $.ajax({
            url: "{{charge_fill_url}}",
            type: "post",
            data: {
              pay_type: vbankStyle,
              amount: vamount,
              pay_account_bank: vbank,
              pay_account_num: vbankId,
              pay_account_username: vbankName,
              random_num: "{{random_num}}",
              order_id : "{{order_id}}",
              out_trade_no: "{{out_trade_no}}",
              sign: "{{sign}}"
            },
            error: function (xhr) {
              $(".loading_img").hide();
              openMsg("查看失敗，请重新操作。", false, 0)
              submitTouch = true
              $('.list input').removeAttr("readonly");
              $('.list select').attr("disabled", false);
            },
            success: function (response) {
              $(".bg").hide();
              $(".loading_img").hide();
              submitTouch = true
              $(".transferAccount").show();
              $("#checkSubmit").hide();
            }
          });
        }
      }
      // 確認提交按鈕事件
      $("#checkSubmit").click(function () {
        checkFunction();
      });
      $(document).keypress(function (e) {
        if (e.which == 13) {
          document.activeElement.blur();
        }
      });
    });
  </script>

  <style>
    body {
      margin: 0;
    }
    #cnzz_stat_icon_1273487022 {
      display: none;
    }
    h1 {
      display: inline-block;
      width: 88%;
      font-size: 1rem;
      text-align: center;
      color: #fff;
      vertical-align: middle;
      font-weight: lighter;
      margin: 0.5rem auto;
    }

    .header {
      top: 0;
      width: 100%;
      background: #FB5926;
    }

    .header a {
      text-decoration: blink;
    }

    .header input[type="button"] {
      background-image: url("http://p.hcoriental.com/back.png");
      background-size: 1.5rem 1.5rem;
      background-color: #FB5A27;
      background-repeat: no-repeat;
      -webkit-appearance: none;
      -moz-appearance: none;
      appearance: none;
      width: 6%;
      height: 1.5rem;
      border: none;
      vertical-align: middle;
    }

    .message-style-1 {
      background-color: #EEEDEE;
      padding: 0.5rem 0;
      font-size: 0.7rem;
    }

    .message-style-1 p {
      display: inline;
    }

    .message-style-1 span {
      margin-left: 0.2rem;
    }

    .bank_text {
      margin-top: 0.5rem;
    }

    .transferAccount {
      display: none;
    }

    .transferAccount img:nth-child(1) {
      width: 10rem;
      margin-left: 0.8rem;
      margin-top: 0.3rem;
    }

    .bank-frame {
      background-color: #FFF;
    }

    .bank-frame div {
      margin: 0.5rem auto;
    }

    .bank-frame h4 {
      display: inline-block;
      width: 25%;
      margin: 0;
      padding: 0.5rem 0.5rem 0.5rem 1rem;
      font-size: 14px;
    }

    .bank-frame p {
      display: inline;
      font-size: 14px;
    }

    .bank-frame div p:nth-child(1) {
      margin-left: 0.5rem;
      font-weight: bold;
    }

    .bank-frame div p:nth-child(2) {
      color: #656565;
    }

    .bank-frame div p:nth-child(3) {
      color: #FB5926;
      float: right;
      margin: 0 0.1rem 0 0;
      border: 1px solid #000000;
      padding: 0 1rem 0 1rem;
      border-color: #FB5926;
      border-style: solid;
      border-radius: 0.5rem;
    }

    .bank-frame div:nth-child(2) p:nth-child(1) {
      letter-spacing: 0.3rem;
    }

    .bank-frame div:nth-child(3) p:nth-child(1) {
      letter-spacing: 0.5rem;
    }

    .message-style-2 {
      background-color: #EEEDEE;
      margin-top: 1rem;
      font-size: 0.7rem;
    }

    .message-style-2 span {
      margin-left: 0.2rem;
      color: red;
    }

    .transfer-raiders {
      color: red;
      padding: 0.5rem 0;
      width: 20%;
      display: block;
      text-align: center;
      text-decoration: none;
      margin-left: auto;
      margin-right: auto;
      text-decoration: underline;
    }

    .message-style-2 p {
      display: inline-block;
      vertical-align: middle;
    }

    .suggestionMessage {
      /* display: none; */
      /* position: fixed; */
      width: 100%;
      height: 100%;
      background: #000;
      z-index: 2;
      opacity: 0.7;
    }

    .nextBtn {
      background-color: #FB5926;
      color: #fff;
      padding: 0.4rem 1.5rem;
      width: 75%;
      border-radius: 0.3rem;
      display: block;
      text-align: center;
      font-size: 1rem;
      text-decoration: none;
      margin-left: auto;
      margin-right: auto;
      margin-top: 1rem;
      margin-bottom: 5rem;
    }

    .list {
      background: #fff;
      color: #000;
      padding: 0 1rem;
      border-radius: 0.2rem;
      font-weight: 200;
      font-size: 14px;
    }

    .list h4 {
      display: inline-block;
      width: 25%;
      margin: 0;
      padding: 0.5rem 0.5rem 0.5rem 0;
      font-size: 14px;
      margin-bottom: 0.5rem;
    }

    .list .idname {
      display: inline-block;
      margin: 0;
      color: #989898;
      margin-left: 0.5rem;
    }

    .list select {
      font-weight: 200;
      font-size: 12px;
      width: 65%;
      padding: 0.3rem 1.5rem 0.3rem 0.5rem;
      background-image: url("http://ooi5vuy91.bkt.clouddn.com/compress/jiantou.png");
      background-repeat: no-repeat;
      background-position: right;
      border: none;
      background-color: #fff;
      background-size: 1.5rem 1.7rem;
      -webkit-appearance: none;
      -moz-appearance: none;
      border: 1px solid #EEEDEE;
      border-radius: 0px;
    }

    .list input {
      font-weight: 200;
      font-size: 12px;
      display: inline-block;
      width: 60%;
      -webkit-appearance: none;
      -moz-appearance: none;
      border: none;
      padding: 0.3rem 0.3rem 0.3rem 0.8rem;
      border: 1px solid #EEEDEE;
    }

    .list p {
      float: right;
      color: #FB5A29;
      margin-top: 0.4rem;
    }

    #amount {
      color: #FB5A29;
    }

    .show_end {
      text-align: center;
      margin-top: 2.5rem;
      margin-right: 2rem;
      margin-left: 1.2rem;
    }

    .show_end img {
      width: 1.3rem;
      float: left;
      margin-top: -0.5rem;
    }

    .show_end h4 {
      text-align: left;
      margin-left: 1.5rem;
      font-size: 0.9rem;
    }

    .show_end h4:nth-child(4) {
      margin-top: 40%;
    }

    .show_end p {
      text-align: left;
      margin-top: -1rem;
      font-size: 0.7rem;
      margin-left: 1.5rem;
    }

    .succeed {
      width: 25%;
      margin: 2rem auto 1.5rem;
    }

    .bg {
      display: none;
      position: fixed;
      width: 100%;
      height: 100%;
      background: #000;
      z-index: 2;
      top: 0;
      left: 0;
      opacity: 0.7;
    }

    .alter_content {
      display: none;
      width: 69%;
      height: 10%;
      position: fixed;
      top: 50%;
      margin-top: -4rem;
      background: #fff;
      z-index: 3;
      left: 15%;
      border-radius: 10px;
      text-align: center;
      line-height: 3.7rem;
      font-size: 1rem;
    }

    .loading_img {
      display: none;
      width: 14%;
      position: fixed;
      top: 50%;
      margin-top: -4rem;
      background: rgba(84, 84, 84, 0.19);
      z-index: 3;
      left: 43%;
      border-radius: 55px;
      text-align: center;
      line-height: 3.7rem;
      font-size: 1rem;
    }

    #page3 img {
      width: 100%;
    }

    #page3 div {
      position: absolute;
      left: 0px;
      top: 0px;
      z-index: 3;
      padding: 2rem;
    }
  </style>

</head>

<body>
  <div id="page1">
    <div class="header">
      <a class="backToHome" href="javascript:void(0);">
        <input type="button" class="goToRecharge">
      </a>
      <h1>网银转帐</h1>
    </div>
    <div class="content">
      <div class="message-style-1">
        <span>•</span>
        <p>以下是您欲要转帐的银行帐户资料</p>
      </div>
      <div class="list">
        <h4>我的ID</h4>
        <span class="idname">{{user_id}}</span>
        <!-- <span class="idname">567543</span> -->
      </div>
      <div class="list">
        <!-- loki显示：存款人姓名 witch显示：入款人姓名 -->
        <h4 id="listName">存款人姓名</h4>
        <input id="bankName" type="text" class="put" maxlength="20" placeholder="请填写存款人姓名">
      </div>
      <div class="list">
        <!-- loki显示：转帐方式 witch显示：入款方式 -->
        <h4 id="bankStyleH4">转帐方式</h4>
        <select id="bankStyle" value="bankcard">
          <option value="bankcard">银行卡转账</option>
          <option value="alipay">支付宝</option>
          <option value="wechat">微信</option>
          <option value="others">其他方式转账</option>
        </select>
      </div>
      <div class="list" id="applyBank">
        <h4>转帐银行</h4>
        <select id="bank">
          <option value="1">请选择您的开户银行</option>
          <option value="工商银行">工商银行</option>
          <option value="建设银行">建设银行</option>
          <option value="中国银行">中国银行</option>
          <option value="农业银行">农业银行</option>
          <option value="交通银行">交通银行</option>
          <option value="招商银行">招商银行</option>
          <option value="中信银行">中信银行</option>
          <option value="光大银行">光大银行</option>
          <option value="华夏银行">华夏银行</option>
          <option value="浦发银行">浦发银行</option>
          <option value="兴业银行">兴业银行</option>
          <option value="民生银行">民生银行</option>
          <option value="平安银行">平安银行</option>
          <option value="广发银行">广发银行</option>
          <option value="其它银行">其它银行</option>
        </select>
      </div>
      <div class="list" id="listNotShow">
        <h4 id="listId">银行卡号</h4>
        <input id="bankId" type="text" class="put" maxlength="24" placeholder="请输入您转账的银行卡号">
      </div>
      <div class="list">
        <h4>金额</h4>
        <input id="amount" type="number" class="put" maxlength="12" placeholder="最低转帐金额为50元" />
      </div>
      <div class="bank_text">
        <div class="message-style-2">
          <span>!</span>
          <p id="message_p">单笔最低转帐金额为50元,&nbsp;100元以上可享1%充值返利</p>
        </div>
        <a id="backP3" class="transfer-raiders" href="javascript:void(0);">转帐攻略</a>
        <div class="message-style-1">
          <span>•</span>
          <p>完成以上信息填写后，请查看收款帐号并在1小时内转帐</p>
        </div>
      </div>
      <a id="checkSubmit" class="nextBtn">查看需要转帐的银行帐户</a>
      <div class="transferAccount">
        <div class="bank-frame">
          <div>
            <h4>开户支行</h4>
            <p>{{bankcard.subbranch}}</p>
            <!-- <p>浙江天猫支行</p> -->
          </div>
          <div>
            <h4>收款人</h4>
            <p id="bankOwner">{{bankcard.account_holder}}</p>
            <!-- <p id="bankOwner">李翠花</p> -->
            <p id="copyOwner" class="copybtn" href="javascript:void(0)" data-clipboard-target="#bankOwner">复制</p>
          </div>
          <div>
            <h4>银 行</h4>
            <p>{{bankcard.bank}}</p>
            <!-- <p>中国银行</p> -->
          </div>
          <div>
            <h4>银行卡号</h4>
            <p id="bankCard">{{bankcard.account_number}}</p>
            <!-- <p id="bankCard">9873987623488898</p> -->
            <p id="copy" class="copybtn" href="javascript:void(0)" data-clipboard-target="#bankCard">复制</p>
          </div>
        </div>
        <a id="backP2" class="nextBtn" href="javascript:void(0);">我已转帐</a>
      </div>
    </div>
  </div>
  <div id="page2">
    <div class="header">
      <a id="backP1" href="javascript:void(0);">
        <input type="button" class="goToRecharge">
      </a>
      <h1>提交成功</h1>
    </div>
    <div class="content">
      <div class="show_end">
        <img class="succeed" src="http://ooi5vuy91.bkt.clouddn.com/compress/tu1.png" alt="自助充值成功">
        <h4>您的充值申请已经提交成功，正在审核中</h4>
        <p id="user_amount">提交金额 0元，若订单确认无误，系统充值将会在1分钟内到帐，请留意站内消息通知</p>
        <h4>充值成功</h4>
        <p>充值成功后，您的余额将会更新，请稍候等待。届时若仍未到账，请联系“在线客服”</p>
      </div>
      <a class="nextBtn backToHome" href="javascript:void(0);">完 成</a>
    </div>
  </div>
  <div id="page3">
    <img id="riders_img" src="http://p.hcoriental.com/strategy.jpg" alt="图片加载失败请点击图片返回">
    <div> </div>
  </div>
  <div class="bg"></div>
  <div class="alter_content">提交失败，请重新操作。</div>
  <img class="loading_img" src="http://ow8xcte3z.bkt.clouddn.com/loading.gif" alt=" ">
</body>

</html>
